import { ref } from 'vue'

function useTabs<T = number>(option: {activeKey: T}) {
  const activeKey = ref<T>(option.activeKey)
  function setActiveKey(data: T) {
    activeKey.value = data as typeof activeKey.value
  }
  function changeActiveKey(data: T) {
    setActiveKey(data)
  }
  return {
    activeKey,
    changeActiveKey
  }
}

export default useTabs
